

********* This program generates a dataset that combines i, j, and k links in one *********
* This is part 1 of the program. Go to R after this, then run part 2

clear all
set more off, permanently
cd "$localdir\Data"
global output "$localdir\Output"



********** Construct j-data set as input to R (to get j-k links)

* Combine i-j network columns across years
use "network_pairs_FS 2010", clear
g year = 2010

append using "network_pairs_FS 2011"
replace year = 2011 if year==.

append using "network_pairs_FS 2012"
replace year = 2012 if year==.

append using "network_pairs_FS 2013"
replace year = 2013 if year==.

* Restrict attention to the survey people
merge m:1 V1 using "Survey Members code.dta"
keep if _merge==3
rename V2 unique_j
keep year unique unique_j
save "FS 2010-2013", replace // For use later in the code

keep unique_j
rename unique_j unique // The j's
duplicates drop unique, force
sort unique
saveold "J of Survey Members", replace version(12) // For use in R



********** Go to R to run networks construction, then run pt 2 of this program
